using System;
using System.Text;
using System.Collections.Generic;
using System.Net.Mail;

namespace Bamboo.Core.Common.Email
{
    public class Email
    {
        #region Fields
        protected string subject;
        protected string from;
        protected string to;
        protected string body;
        protected Encoding bodyEncoding;
        protected string bodyContentType;
        private ICollection<LinkedResource> linkedResources = new List<LinkedResource>();
        #endregion Fields

        #region Constructors
        public Email()
        {
        }
        public Email(string subject, string from, string to, string body)
            :
            this(subject, from, to, body, "text/html", Encoding.UTF8, new List<LinkedResource>())
        {
        }

        public Email(string subject, string from, string to, string body, string bodyContentType, Encoding bodyEncoding) :
            this(subject, from, to, body, bodyContentType, bodyEncoding, new List<LinkedResource>())
        {
        }

        public Email(string subject, string from, string to, string body, string bodyContentType, Encoding bodyEncoding, ICollection<LinkedResource> linkedResources)
        {
            this.subject = subject;
            this.from = from;
            this.to = to;
            this.body = body;
            this.bodyEncoding = bodyEncoding;
            this.bodyContentType = bodyContentType;
            this.linkedResources = linkedResources;
        }
        #endregion Constructors

        #region Properties
        public string Subject
        {
            get { return subject; }
        }
        public string From
        {
            get { return from; }
        }
        public string To
        {
            get { return to; }
        }
        public string Body
        {
            get { return body; }
        }
        public string BodyContentType
        {
            get { return bodyContentType; }
        }
        public Encoding BodyEncoding
        {
            get { return bodyEncoding; }
        }
        public ICollection<LinkedResource> LinkedResources
        {
            get { return linkedResources; }
        }
	
        #endregion Properties

        public override string ToString()
        {
            return String.Format(@"
                From: {0}
                To: {1}
                Subject: {2}
                Body Content Type: {3}
                Body Encoding : {4}    
                Body: {5}", From, To, Subject, BodyContentType, BodyEncoding, Body);
        }
    }
}
